<?php

require_once('data/SugarBean.php');
require_once('modules/Tasks/Task.php');

class ConnectEditor {
	function ConnectEditor(&$bean, $event, $arguments)
	{
		if(empty($bean->fetched_row) && isset($_REQUEST['parent_id']) && isset($_REQUEST['parent_type']) && $_REQUEST['parent_type'] == 'Tasks' && $bean->category_id == 'EditorRelated'){
			$task = new Task();
			$task->retrieve($_REQUEST['parent_id']);
			if(isset($task->related_editor_id)){
				$bean->related_editor_id = $task->related_editor_id;				
			}
		}
	}
}

?>
